<?php

/**
 * 安装程序入口文件
 *
 * @package    01CMS
 * @subpackage install
 * @author     rolong at vip.qq.com
 * @version    1.0.0
 * @link       http://www.01cms.com
 */

//开发期间去掉以下两行注释
ini_set('display_errors', 'on');
error_reporting(E_ALL);

//设定编码
header('Content-Type: text/html; charset=utf-8');

//定义根路径
define('ROOT_PATH', ereg_replace('[\\/]+', '/', realpath('../')));

//公共静态资源路径
define('PUBLIC_PATH', ROOT_PATH . '/public');

//定义APP路径
define('APP_PATH', ereg_replace('[\\/]+', '/', dirname(__FILE__)));

//定义01MVC框架目录
define('SYS_PATH', ROOT_PATH . '/01mvc');

//定义非命令行下运行时需要的常量
if (empty($_SERVER['argv']))
{
    $port = ($_SERVER['SERVER_PORT'] == '80') ? '' : ':' . $_SERVER['SERVER_PORT'];
    
    //定义APP入口URL
    define('BOOT_URL', 'http://' . $_SERVER['SERVER_NAME'] . $port . $_SERVER['SCRIPT_NAME']);
    
    //定义APP根目录
    define('BOOT_DIR', str_replace('/' . basename(BOOT_URL), '', BOOT_URL));
    
    //定义站点根目录
    define('ROOT_DIR', substr(BOOT_DIR, 0, strrpos(BOOT_DIR, '/')));
    
    //定义站点公共静态资源目录
    define('PUBLIC_DIR', ROOT_DIR . '/public');
}

//启动...
require SYS_PATH . '/boot.php';

//END